import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/views/index.vue'
import Levels from '@/views/levels.vue'
import Playground from '@/views/playground.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: 'index',
      component: Index,
      props: true
    },
    {
      path: '/index/:levelKey?',
      name: 'index',
      component: Index,
      props: true
    },
    {
      path: '/levels',
      name: 'levels',
      component: Levels
    },
    {
      path: '/playground',
      name: 'playground',
      component: Playground
    }
  ],
  scrollBehavior() {
    return {
      top: 0,
      behavior: 'smooth'
    }
  }
})

export default router
